local shoutan = fk.CreateSkill {

  name = "joy__shoutan",

  tags = {  },

}



shoutan:addEffect("active", {
  name = "joy__shoutan",
  anim_type = "switch",
  switch_skill_name = "joy__shoutan",
  card_num = function()
    if player:hasSkill("joy__yaoyi") then
      return 0
    else
      return 1
    end
  end,
  target_num = 0,
  can_use = function(self, player)
    if player:hasSkill("joy__yaoyi") then
      return true and player:getMark("joy__shoutan-phase") == 0 
    else
      return player:usedSkillTimes(shoutan.name, Player.HistoryPhase) == 0
    end
  end,
  card_filter = function(self, player, to_select, selected)
    if player:hasSkill("joy__yaoyi") then
      return false
    elseif #selected == 0 and Fk:currentRoom():getCardArea(to_select) ~= Card.PlayerEquip then
      if player:getSwitchSkillState(shoutan.name, false) == fk.SwitchYang then
        return Fk:getCardById(to_select).color ~= Card.Black
      else
        return Fk:getCardById(to_select).color == Card.Black
      end
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    if player:hasSkill("joy__yaoyi") then
      room:setPlayerMark(player,"joy__shoutan-phase",1)
    end
    room:throwCard(effect.cards, shoutan.name, player, player)
  end,
})

return shoutan